const _ = require("lodash");
const fp = require("lodash/fp");

//01pointfree演示  Hello  Wrold =>hello_world
const fn = fp.flowRight(fp.replace(/\s+/g, "_"), fp.toLower);
console.log(fn("Hello  Wrold"));

//02 把一个字符组中的首字母提取并转换程大写使用.作为分隔符号  world wild web =>W.W.W
// const firstLetterToUpper = fp.flowRight(fp.join('. '), fp.map(fp.first), fp.map(fp.toUpper), fp.split(' '))
const firstLetterToUpper = fp.flowRight(
  fp.join(". "),
  fp.map(fp.flowRight(fp.first, fp.toUpper)),
  fp.split(" ")
);
console.log(firstLetterToUpper("world wild web"));
